﻿Imports System.Windows.Forms
Public Class DragLineTool
    Inherits BaseTool


    Public Overrides Sub mouseDblClick(ByVal sender As Object, ByVal e As System.EventArgs)

    End Sub

    Public Overrides Sub mouseDown(ByVal sender As Object, ByVal e As AxMapWinGIS._DMapEvents_MouseDownEvent)

        If e.button = 1 Then


            If Me.OperShapeProperty Is Nothing Then '第一次绘制



                Me.OperShapeProperty = ShapeFactory.getNewLineShape()


                Me.OperShapeProperty.P1Property = New Drawing.Point(e.x, e.y)
                Me.OperShapeProperty.plist.Add(Me.DownPointProperty)











            End If


        End If


    End Sub

    Public Overrides Sub mouseDrag(ByVal sender As Object, ByVal e As AxMapWinGIS._DMapEvents_MouseMoveEvent)

    End Sub

    Public Overrides Sub mouseMove(ByVal sender As Object, ByVal e As AxMapWinGIS._DMapEvents_MouseMoveEvent)
        'If Me.OperShapeProperty Is Nothing Then
        '    Return
        'End If

        If Me.OperShapeProperty.plist.Count = 1 Then


            Dim p As New Drawing.Point
            p.X = Me.OperShapeProperty.plist.Item(0).X
            p.Y = Me.OperShapeProperty.plist.Item(0).Y


            'ControlPaint.DrawReversibleLine(getScreen(Me.OperShapeProperty.plist.Item(0)), getScreen(Me.OldmovepointProperty), lColor)

            'ControlPaint.DrawReversibleLine(getScreen(Me.OperShapeProperty.plist.Item(0)), getScreen(Me.NewmovepointProperty), lColor)

            ControlPaint.DrawReversibleLine(p, getScreen(Me.OldmovepointProperty), lColor)

            ControlPaint.DrawReversibleLine(p, getScreen(Me.NewmovepointProperty), lColor)



        End If

    End Sub

    Public Overrides Sub mouseUp(ByVal sender As Object, ByVal e As AxMapWinGIS._DMapEvents_MouseUpEvent)
        If e.button = 1 Then



            Dim pt As New Drawing.Point(e.x, e.y)
            Me.OperShapeProperty.plist.Add(pt)
            InvokeEndDrawing()
            Me.OperShapeProperty = Nothing

        End If
    End Sub

    Public Overrides Sub setself()

    End Sub

    Public Overrides Sub unSet()

    End Sub


End Class
